package net.tavion.angelboot.common.enums;

public enum AngelChannel {

    WEB("WEB","web渠道"),
    iOS("IOS","ios渠道"),
    Android("Android","Android渠道"),

    ;

    private String code;

    private String name;

    AngelChannel(String code, String name) {
        this.code = code;
        this.name = name;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public static AngelChannel  getByCode(String code){
        AngelChannel[] enums=AngelChannel.values();
        for (AngelChannel e : enums) {
            if(e.getCode().equals(code)){
                return e;
            }
        }
        return null;
    }


    public static boolean validate(String code){
        AngelChannel[] enums=AngelChannel.values();
        for (AngelChannel e : enums) {
            if(e.getCode().equals(code)){
                return true;
            }
        }

        return false;
    }
}
